import { requestFunc, responseErrorFunc, responseSuccessFunc } from './interceptor.js';
import initData from './data/index.js';
const services1 = {
	development: 'http://xxx/api/module',
	proxy: 'http://xxx/api/module',
	test: 'http://xxx/api/module',
	production: 'http://xxx/api/module',
};


// console.log(Api,'--Api--');
// console.log($JiessHttp,'--$JiessHttp--');

export const httpBaseInfo = {
	timeout: 5000,
	interceptors: {
		responseSuccess: responseSuccessFunc,
		responseError: responseErrorFunc,
		request: requestFunc,
	},
	customFetch: async (a, b) => {
		await new Promise(resolve => {
			setTimeout(resolve, 500);
		});
		const data = await initData(a, b);
		return {
			response: { code: 200, msg: '成功', data }
		}
	}
};

export const httpConfig1 = { baseURL: services1[process.env.NODE_ENV], ...httpBaseInfo };
export const api1 = new $JiessHttp(httpConfig1);